cmake_minimum_required(VERSION 2.8)
project(gateway)

set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wno-invalid-source-encoding")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wno-invalid-source-encoding")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_definitions("-fPIC -m64 -g -Wall -Wno-overloaded-virtual -fstack-protector -fstack-protector-all -Wno-unused-private-field -Wno-unused-value -Wno-reorder -Wno-unused-variable -Wno-missing-declarations")

INCLUDE_DIRECTORIES(
  /usr/local/include
)

SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/so)

aux_source_directory(./user/ SRC_LIST)
aux_source_directory(../protocol_files/common/protobuf_generated SRC_LIST)
aux_source_directory(../protocol_files/gateway/ SRC_LIST)
aux_source_directory(../protocol_files/dispatcher/ SRC_LIST)

LINK_DIRECTORIES(
 /usr/local/lib/
 /usr/lib/
 /usr/lib64/
)

ADD_LIBRARY(gateway SHARED ${SRC_LIST})

target_link_libraries(
	gateway
	-lpthread
	-lrt
	-ldl
	libplugin.a
	libprotobuf.a
	libkratos_core.a
)

INSTALL(TARGETS gateway DESTINATION so)
